package cn.tedu.boot041.controller;

import cn.tedu.boot041.entity.User;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AxiosController {
    @RequestMapping("/helloAxios")
    public String helloAxios(String name){
        return "服务器接收到了请求!"+name;
    }


    //当客户端发出的是post请求并且提交的参数是JS对象的情况下需要添加@RequestBody注解 否则接收到的是null
    @RequestMapping("/postAxios")
    public String postAxios(@RequestBody User user){

        return "post请求成功!"+user.toString();
    }



}
